VT-d: introduce new fields in msi_desc to track binding with guest interrupt
authorFeng Wu <feng.wu@intel.com>
Fri, 7 Apr 2017 13:37:07 +0000 (15:37 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 7 Apr 2017 13:37:07 +0000 (15:37 +0200)
commita5e25908d18d30722a99f0e2e75985634ab0933c
tree6f88b9f30e4a6f302537dac6d7a28d5588d2f418
parent1066331913c9f37856dcbc161e9833dc43650c64
VT-d: introduce new fields in msi_desc to track binding with guest interrupt

msi_msg_to_remap_entry() is buggy when the live IRTE is in posted format. It
wrongly inherits the 'im' field meaning the IRTE is in posted format but
updates all the other fields to remapping format.

There are also two situations that lead to the above issue. One is some callers
really want to change the IRTE to remapped format. The other is some callers
only want to update msi message (e.g. set msi affinity) for they don't aware
that this msi is binded with a guest interrupt. We should suppress update
in the second situation. To distinguish them, straightforwardly, we can let
caller specify which format of IRTE they want update to. It isn't feasible for
making all callers be aware of the binding with guest interrupt will cause a
far more complicated change (including the interfaces exposed to IOAPIC and
MSI). Also some callings happen in interrupt context where we can't acquire
d->event_lock to read struct hvm_pirq_dpci.

This patch introduces two new fields in msi_desc to track binding with a guest
interrupt such that msi_msg_to_remap_entry() can get the binding and update
IRTE accordingly. After that change, pi_update_irte() can utilize
msi_msg_to_remap_entry() to update IRTE to posted format.

Signed-off-by: Feng Wu <feng.wu@intel.com>
Signed-off-by: Chao Gao <chao.gao@intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/msi.c
xen/drivers/passthrough/io.c
xen/drivers/passthrough/vtd/intremap.c
xen/include/asm-x86/iommu.h
xen/include/asm-x86/msi.h